﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace LinqToSQL.Manning
{
    public class Other
    {

        #region Constructor
        private static Other _Instance = null;
        private Other()
        {
        }
        static readonly private object padLock = new object();
        public static Other Instance
        {
            get
            {
                if (_Instance == null)
                    lock (padLock)
                    {
                        if (_Instance == null)
                            _Instance = new Other();
                    }
                return _Instance;
            }
        }
        #endregion

        public void p()
        {
            /*
             * 1) labels for parameters
             * 2) optional parameters and default values
             * 3) Simplifying COM interoperability
             * 4) Interoperating with a dynamic language
            */
        }

        public class NamedList
        {
            public Customer cust { get; set; }
            public List<Product> prods { get; set; }
            public string Name { get; set; }
        }

        public void InitializersTest()
        {
            int p = 0x11;
            float f = 1.0F;
            NamedList list = new NamedList
            {
                Name = "my new list",
                prods = new List<Product>() 
                {
                    new Product() {ProductID = 1, Name = "prod 1"}
                },
                cust = new Customer(){CustomerID = 2, LastName = "test customer"}
            };

            //ANONIMOUS ARRAY
            var q = new[] { new { type = "odd" }, new { type = "even" } };
        }
    }
}
